$('.setAgent').on('click', function(event) {
	event.stopPropagation()
})

$('.user_name').on('click', function() {
	$('.setup').show();
})
$('.setup').on('click', function() {
	$(this).hide();
})
//获取时间
function show() {
	var mydate = new Date();
	var str = "" + mydate.getFullYear() + "-"; //年
	var scc = (mydate.getMonth() + 1); //月
	//小于2位补0
	if(scc < 10) {
		str += ('0' + scc + '-')
	} else {
		str += (scc + '-')
	}
	var stp = mydate.getDate() + 'T'; //日
	if(stp < 10) {
		str += ('0' + stp)
	} else {
		str += stp
	}
	var my_hours = mydate.getHours();
	if(my_hours < 10) {
		str += ('0' + my_hours + ':')
	} else {
		str += my_hours + ':'
	}
	var my_minutes = mydate.getMinutes();
	if(my_minutes < 10) {
		str += ('0' + my_minutes + ':')
	} else {
		str += my_minutes + ':'
	}
	var my_seconds = mydate.getSeconds();
	if(my_seconds < 10) {
		str += ('0' + my_seconds)
	} else {
		str += my_seconds;
	}
	return str;
}

var str = show();
//			alert(str);
$('.pull-span').html(str.substring(0, 4));
if(str.substring(5, 7) < 10) {
	var app = '年' + '0' + str.substring(6, 7) + '月';
	app += str.substring(8, 10) + '日';
	$('em').html(app)
}
$('.strongs').html(str.substring(11, str.length))

$('.confirm_sbmit').on('click', function(event) {
	event.stopPropagation();
	var name = $('.names_2').val();
	var password = $('.poswd_2').val();
	var confirm = $('.confirm').val();
	var s = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/;
	if(confirm == password) {
		if(s.test(password)) {
			$.ajax({
				type: "get",
				url: "/proxy/setAccountName",
				contentType: "application/json; charset=utf-8",
				data: {
					'password': name,
					'passWord2': password
				},
				success: function(res) {
					console.log(res)
					if(res.error_code == 0) {
						alert(res.msg + '，跳转到登录页面！')
						window.location.href = 'login.html';
					} else if(res.error_code == 1) {
						alert(res.msg + '!')
					}
				}
			});
		} else {
			alert('密码必须为长度 6~12 位的数字字母组成')
		}
	} else {
		alert('两次输入的密码不一致！')
	}
})